package oktx.sample.dubbo;

import oktx.sample.dubbo.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by dave on 18-5-20 上午11:20.
 */
@Service
@com.alibaba.dubbo.config.annotation.Service
public class UserApiImpl implements UserApi {
    @Autowired UserMapper userMapper;

    @Override
    public User addUser(User user) {
        userMapper.insert(user);
        return user;
    }

    @Override
    public List<User> getUsers() {
        return userMapper.getList();
    }

    @Override
    public void removeAllUsers() {
        userMapper.clear();
    }
}
